package pl.nazaweb.utils.restpojomaper;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author naza - Marek Kawczyński
 */
public class MapAsMapTestRest extends PojoAutoMapper<SampleEntity> {

    private List<SampleEntity> getList() {
        List<SampleEntity> list = new ArrayList();
        for (int x = 0; x < 10; x++) {
            SampleEntity entity = new SampleEntity();
            entity.setId(x);
            entity.setCode(x * 10);
            entity.setName("encja " + x);
            entity.setDescription("opis encji " + x);
            list.add(entity);
        }
        return list;
    }

    @Override
    @MapAsMap(keyProperty = "getId", valueProperty = "getName")
    protected List getAll() {
        return getList();
    }

    @Override
    protected List create(List entities) {
        return getList();
    }
}
